global class MyFirstBatch implements Database.Batchable<sObject> {
    public String query;
    global AddPunishmentInformationOpp(String query) {
        this.query =query;
    }

    global Database.getQueryLocator start(Database.BatchableContext bc) {
        // 查询需要清空客户网点字段的客户记录
        String query = 'SELECT Id FROM Account';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, list<Sobject> scope) {
        // 清空客户网点字段值
        for (Account acc : scope) {
            acc.ClientBranch__c = null;
        }
        update scope;
    }
    

    global void finish(Database.BatchableContext BC) {
        System.debug('批处理作业已经完成');
    }
    public void execute(SchedulableContext sc) {
        // 创建定时调度任务
        ClearAccountBranchBatch batch = new ClearAccountBranchBatch();
        String jobId = System.schedule('Clear Account Branch', '0 0 0 * * ?', batch);
        System.debug('Scheduled job ID: ' + jobId);
    }
}
